from redis import StrictRedis

import logging

class Config(object):
    " 项目配置 "

    SECRET_KEY = 'CI5y+0wCv5gUoiskuRssAdJXaa6mr+lwVWHeECU0F+RQs5RO2+RspjxDOBeBrXaG'
    # 数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:960818@127.0.0.1:3306/information1'
    SQLALCHEMY_TRACK_MODIFICATIONS =False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    # redis配置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    SESSION_TYPE ='redis'
    SESSION_PERMANENT = False
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400*4
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    # 默认日志等级
    LOG_LEVEL = logging.DEBUG

class DevelopMentConfig(Config):
    "开发环境下的配置"
    DEBUG = True

class ProdoctonConfig(Config):
    "生产环境的配置"
    DEBUG = False
    LOG_LEVEL = logging.ERROR

class TestingConfig(Config):
    "单元测试的配置"
    DEBUG = True
    TESTTING = True

config = {
    'development':DevelopMentConfig,
    'prodoction':ProdoctonConfig,
    'testing':TestingConfig
}